package com.zelma.house.controller;

import java.util.Arrays;
import java.util.Map;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zelma.house.entity.OrderTypeEntity;
import com.zelma.house.service.OrderTypeService;
import com.zelma.common.utils.PageUtils;
import com.zelma.common.utils.R;



/**
 * 
 *
 * @author zelma
 * @email 1239115389@qq.com
 * @date 2022-01-07 14:58:16
 */
@RestController
@RequestMapping("house/ordertype")
public class OrderTypeController {
    @Autowired
    private OrderTypeService orderTypeService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = orderTypeService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{resourceOrderId}")

    public R info(@PathVariable("resourceOrderId") Integer resourceOrderId){
		OrderTypeEntity orderType = orderTypeService.getById(resourceOrderId);

        return R.ok().put("orderType", orderType);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")

    public R save(@RequestBody OrderTypeEntity orderType){
		orderTypeService.save(orderType);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody OrderTypeEntity orderType){
		orderTypeService.updateById(orderType);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")

    public R delete(@RequestBody Integer[] resourceOrderIds){
		orderTypeService.removeByIds(Arrays.asList(resourceOrderIds));

        return R.ok();
    }

}
